local guibi = fk.CreateSkill{
  name = "hanqing__guibi",
  attached_skill_name = "hanqing__guibi&",
}

Fk:loadTranslationTable{
  ["hanqing__guibi"] = "归璧",
  [":hanqing__guibi"] = "每名角色限一次，其他角色的出牌阶段，其可以展示你至多你装备区牌数张牌，然后你选择一项："..
  "1.使用其中的基本牌（无距离限制）；2.重铸其中的非基本牌。然后，其获得其余展示牌。",
}

guibi:addEffect(fk.AfterCardsMove, {
  can_refresh = function (self, event, target, player, data)
    if player.seat == 1 then
      for _, move in ipairs(data) do
        if move.toArea == Card.Processing and move.moveReason == fk.ReasonUse then
          return true
        end
      end
    end
  end,
  on_refresh = function (self, event, target, player, data)
    local room = player.room
      for _, move in ipairs(data) do
        if move.toArea == Card.Processing and move.moveReason == fk.ReasonUse then
          local parent_event = room.logic:getCurrentEvent().parent
          if parent_event ~= nil then
            if parent_event.event == GameEvent.UseCard then
              local use = parent_event.data
              if use.extra_data and use.extra_data.hanqing__guibi then
                for _, info in ipairs(move.moveInfo) do
                  if use.extra_data.hanqing__guibi[1] == info.cardId then
                    room:setCardMark(Fk:getCardById(info.cardId), "hanqing__hejiang", use.extra_data.hanqing__guibi[2])
                  end
                end
              end
            end
          end
        end
      end
  end,
})

return guibi
